package com.ricchieri.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.springframework.cache.annotation.Cacheable;

import com.ricchieri.dao.interf.IDocumentTypeDao;
import com.ricchieri.filter.BasicFilter;
import com.ricchieri.model.DocumentType;

public class DocumentTypeDao extends GenericDao implements IDocumentTypeDao {

	private static final long serialVersionUID = 2544028028271007163L;

	@Override
	@Cacheable(value="documentType")
	@SuppressWarnings("unchecked")
	public List<DocumentType> getAllDocumentsTypes(BasicFilter filter) {
		Criteria criteria = criteriaAllDocumentType(filter);
		
		return criteria.list();
	}
	
	private Criteria criteriaAllDocumentType(BasicFilter filter) {
		return super.criteriaAllBasic(filter, DocumentType.class);
	}	
	
	@Override
	protected String getTableName() {
		return "documentType";
	}
}
